package com.zhang.controller;


import com.zhang.entity.Department;
import com.zhang.responce.Result;
import com.zhang.service.DepartmentService;
import com.zhang.vo.DepartmentVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Zhang
 * @since 2022-03-02
 */
@RestController
@RequestMapping("/department")
@Api(value = "部门模块", tags = "部门模块接口")
public class DepartmentController {
    @Autowired
    private DepartmentService departmentService;

    @GetMapping("/deplist")
    @ApiOperation(value = "获取所有部门信息",tags = "")
    public Result departmentList(){
        List<DepartmentVO> departmentList = departmentService.findDepAndCount();
        return Result.ok().data("departments",departmentList);
    }

}

